﻿using System;
using Microsoft.Win32;

namespace JipPlayer_2._0
{
    public partial class frmSettingsDX : DevExpress.XtraEditors.XtraForm
    {
        public frmSettingsDX()
        {
            InitializeComponent();
        }
        readonly RegistryKey regKeys = Registry.CurrentUser.OpenSubKey("Software\\JipPlayer 2.0", true);        

        private void btnClose_Click(object sender, EventArgs e)
        {
            if (scrobble.Checked)
            {
                regKeys.SetValue("useLastFM", "True");
            }
            else
            {
                regKeys.SetValue("useLastFM", "False");
            }

            if (nowPlaying.Checked)
            {
                regKeys.SetValue("useNowPlaying", "True");
            }
            else
            {
                regKeys.SetValue("useNowPlaying", "False");
            }
            Close();
        }

        private void frmSettingsDX_Load(object sender, EventArgs e)
        {
            if (regKeys.GetValue("useNowPlaying", "False").ToString() == "True")
            {
                nowPlaying.Checked = true;
            }
            else
            {
                nowPlaying.Checked = false;
            }
            if (regKeys.GetValue("useLastFM", "False").ToString() == "True")
            {
                scrobble.Checked = true;
            }
            else
            {
                scrobble.Checked = false;
            }
        }
    }
}